template <class T>
EnemySpawner<T>::EnemySpawner(int X, int Y)
{
    T test;
    dynamic_cast<Enemy&>(test); //Enforce Enemy Type
    this->X = X;
    this->Y = Y;
    fixedRate = 0;
}

template <class T>
void EnemySpawner<T>::spawnEnemy()
{
    T* enemy = new T;
    enemy->OnLoad();
    enemy->X = X;
    enemy->Y = Y;
    CEntity::EntityList.push_back(enemy);
}


template <class T>
void EnemySpawner<T>::spawnEnemyAtFixedRate(int milliseconds)
{
    fixedRate = milliseconds;
    fixedRateTimer = new SDLTimer(fixedRate);
}

template <class T>
void EnemySpawner<T>::OnLoop()
{
    if (fixedRate > 0)
    {
        if (fixedRateTimer->isExpired())
        {
            spawnEnemy();
            delete fixedRateTimer;
            fixedRateTimer = new SDLTimer(fixedRate);
        }
    }
}